package com.yyp.dao.impl;

import java.io.Serializable;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.yyp.bean.StaffInfo;
import com.yyp.dao.BaseDao;
import com.yyp.dao.StaffInfoDao;

@Service
@Transactional
public class StaffInfoDaoImpl implements StaffInfoDao {
	@Resource
	BaseDao baseDaoImpl;

	/* (non-Javadoc)
	 * @see com.yyp.dao.impl.StaffInfoDao#delete(java.io.Serializable)
	 */
	public void delete(Serializable names) {
		baseDaoImpl.delete(StaffInfo.class, this.find((String) names).getId());
	}

	/* (non-Javadoc)
	 * @see com.yyp.dao.impl.StaffInfoDao#delete(java.lang.Integer)
	 */
	public void delete(Integer id) {
		baseDaoImpl.delete(StaffInfo.class, id);
	}

	/* (non-Javadoc)
	 * @see com.yyp.dao.impl.StaffInfoDao#find(java.lang.Integer)
	 */
	public StaffInfo find(Integer id) {
		return baseDaoImpl.find(StaffInfo.class, id);
	}

	/* (non-Javadoc)
	 * @see com.yyp.dao.impl.StaffInfoDao#find(java.lang.String)
	 */
	public StaffInfo find(String name) {
		String sql = "from StaffInfo as m where m.isName=?";
		String params[] = { name };
		return baseDaoImpl.find(sql, params);
	}

	/* (non-Javadoc)
	 * @see com.yyp.dao.impl.StaffInfoDao#save(java.lang.Object)
	 */
	public void save(Object entity) {
		baseDaoImpl.save(entity);
	}

	/* (non-Javadoc)
	 * @see com.yyp.dao.impl.StaffInfoDao#findAll()
	 */
	public List<StaffInfo> findAll() {
		String sql = "from StaffInfo";
		return baseDaoImpl.findAll(sql);
	}

	/* (non-Javadoc)
	 * @see com.yyp.dao.impl.StaffInfoDao#updata(java.lang.Object)
	 */
	public void updata(Object entity) {

		baseDaoImpl.updata(entity);
	}

}
